<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>04flex子项flex份数</title>
    <style>
        section {
            display: flex;
            width: 60%;
            height: 150px;
            margin: 0 auto;
            background-color: pink;
        }
        
        section div:nth-child(1) {
            width: 100px;
            height: 100%;
            background-color: fuchsia;
        }
        
        section div:nth-child(2) {
            flex: 1;
            background-color: indianred;
        }
        
        section div:nth-child(3) {
            width: 100px;
            height: 100%;
            background-color: forestgreen;
        }
        
        p {
            display: flex;
            width: 60%;
            height: 150px;
            margin: 20px auto;
            background-color: pink;
        }
        
        p span {
            flex: 1;
            border-right: 1px solid;
        }
        
        p span:nth-child(3) {
            flex: 2;
            border: 0;
        }
    </style>
</head>

<body>
    <section>
        <div>1</div>
        <div>2</div>
        <div>3</div>
    </section>
    <p>
        <span>1</span>
        <span>2</span>
        <span>3</span>
    </p>
</body>

</html>